package cn.org.xuanzp.examples.v2.client.one;

import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.handler.codec.serialization.ClassResolvers;
import io.netty.handler.codec.serialization.ObjectDecoder;
import io.netty.handler.codec.serialization.ObjectEncoder;

/**
 * @Classname NettyClientInitializer
 * @Description TODO
 * @Version 1.0.0
 * @Date 2024/9/24 23:02
 * @Created by xuanzp
 */
public class NettyClientInitializer extends ChannelInitializer<Channel> {

    @Override
    protected void initChannel(Channel ch) throws Exception {
        // TODO Auto-generated method stub
        ch.pipeline()
                .addLast(new ObjectDecoder(ClassResolvers.cacheDisabled(null)))
                .addLast(new NettyClientHandler())
                .addLast(new ObjectEncoder());
    }

}
